package com.rover022.flixelgame.element.weapon.bullet
{
	import com.rover022.flixelgame.element.BaseElement;
	import com.rover022.flixelgame.manager.PlayerManager;
	import org.flixel.FlxG;
	import org.flixel.plugin.photonstorm.FlxWeapon;

	public class BowBullet extends BaseBullet
	{
		public function BowBullet(weapon:FlxWeapon, id:uint)
		{
			super(weapon, id);
		}

		override public function update():void
		{
			super.update();
			//对不是自己的方的人执行碰撞检测
			var array:Array = PlayerManager.getInstance().getOpponentsExcept(factionType);
			for each (var i:BaseElement in array)
			{
				FlxG.overlap(this, i, notifyHandle);
			}
		}

		private function notifyHandle(self:BaseElement, enemy:BaseElement):void
		{
			this.health--;
			enemy.hurtFrom(this.parentElement);
		}
	}
}
